/**
 * Created by zhuo on 2017/8/1.
 */

/**
 * EEMP 项目
 */
var express = require('express');
var router = express.Router();
// import mockCompanyData from './mockData/companysMock.json';
var mockUserData = require('./mockData/usersMock.json');
var result = require("./mockData/operationResult.json");
var updateAndCreateData = {
    "message": "测试内容kglf",
    "result": true,
    "user": {
        "audited": false,
        "createTime": 37427,
        "email": "测试内容5pc7",
        "id": "测试内容38tx",
        "nickname": "测试内容8v11",
        "phone": "测试内容a56w",
        "roleNamename": "测试内容n3w0",
        "username": "添加成功",
        "valid": false
    }
}

/* GET users listing. */
router.get('/getUserList', function(req, res, next) {
    console.info("get users now...");
    mockUserData.draw = req.query.draw;
    res.json(mockUserData);
});

router.post('/create', function(req, res, next) {
    console.info("create user now...");
    res.json(updateAndCreateData);
});
router.post('/delete', function(req, res, next) {
    console.info("delete user now...:"+JSON.stringify(req.body));
    res.json(result);
});
router.post('/update', function(req, res, next) {
    console.info("update user now...");
    res.json(updateAndCreateData);
});

/**
 * ACS 项目
 */
router.get('/divisionList', function(req, res, next) {

    if(!console.itemId){
        console.itemId = 0
    }

    //Print req body
    console.log(JSON.stringify(req.body))
    res.json({
        "message": 1,
        "result": 1,
        "resultData": [
            {
                "id": console.itemId + 1,
                "name": console.itemId + 1
            },
            {
                "id": console.itemId + 2,
                "name": console.itemId + 2
            },
        ]
    });
    console.itemId += 2
});

router.post('/add',function (req, res, next) {
    console.log(req.body)
    res.end()
})

router.get('/list',function (req, res, next) {
    res.json({
        "data": [
        {
            "birthday": 1,
            "certNum": 1,
            "realname": 1,
            "organizationName": 1,
            "roleName": 1,
            "sex": 1,
            "status": 1,
            "username": 1,
            "id": 2
        },
        {
            "birthday": 1,
            "certNum": 1,
            "realname": 1,
            "organizationName": 1,
            "roleName": 1,
            "sex": 1,
            "status": 1,
            "username": 1,
            "id": 3
        },
        {
            "birthday": 1,
            "certNum": 1,
            "realname": 1,
            "organizationName": 1,
            "roleName": 1,
            "sex": 1,
            "status": 1,
            "username": 1,
            "id": 4
        },
        {
            "birthday": 1,
            "certNum": 1,
            "realname": 1,
            "organizationName": 1,
            "roleName": 1,
            "sex": 1,
            "status": 1,
            "username": 1,
            "id": 5
        },
        {
            "birthday": 1,
            "certNum": 1,
            "realname": 1,
            "organizationName": 1,
            "roleName": 1,
            "sex": 1,
            "status": 1,
            "username": 1,
            "id": 6
        },
        {
            "birthday": 1,
            "certNum": 1,
            "realname": 1,
            "organizationName": 1,
            "roleName": 1,
            "sex": 1,
            "status": 1,
            "username": 1,
            "id": 7
        },
        {
            "birthday": 1,
            "certNum": 1,
            "realname": 1,
            "organizationName": 1,
            "roleName": 1,
            "sex": 1,
            "status": 1,
            "username": 1,
            "id": 8
        },
        {
            "birthday": 1,
            "certNum": 1,
            "realname": 1,
            "organizationName": 1,
            "roleName": 1,
            "sex": 1,
            "status": 1,
            "username": 1,
            "id": 9
        },
        {
            "birthday": 1,
            "certNum": 1,
            "realname": 1,
            "organizationName": 1,
            "roleName": 1,
            "sex": 1,
            "status": 1,
            "username": 1,
            "id": 10
        },
        {
            "birthday": 1,
            "certNum": 1,
            "realname": 1,
            "organizationName": 1,
            "roleName": 1,
            "sex": 1,
            "status": 1,
            "username": 1,
            "id": 11
        },
        {
            "birthday": 1,
            "certNum": 1,
            "realname": 1,
            "organizationName": 1,
            "roleName": 1,
            "sex": 1,
            "status": 1,
            "username": 1,
            "id": 12
        },
        {
            "birthday": 1,
            "certNum": 1,
            "realname": 1,
            "organizationName": 1,
            "roleName": 1,
            "sex": 1,
            "status": 1,
            "username": 1,
            "id": 13
        },
        {
            "birthday": 1,
            "certNum": 1,
            "realname": 1,
            "organizationName": 1,
            "roleName": 1,
            "sex": 1,
            "status": 1,
            "username": 1,
            "id": 14
        },
        {
            "birthday": 1,
            "certNum": 1,
            "realname": 1,
            "organizationName": 1,
            "roleName": 1,
            "sex": 1,
            "status": 1,
            "username": 1,
            "id": 15
        },
        {
            "birthday": 1,
            "certNum": 1,
            "realname": 1,
            "organizationName": 1,
            "roleName": 1,
            "sex": 1,
            "status": 1,
            "username": 1,
            "id": 16
        },
        {
            "birthday": 1,
            "certNum": 1,
            "realname": 1,
            "organizationName": 1,
            "roleName": 1,
            "sex": 1,
            "status": 1,
            "username": 1,
            "id": 17
        },
        {
            "birthday": 1,
            "certNum": 1,
            "realname": 1,
            "organizationName": 1,
            "roleName": 1,
            "sex": 1,
            "status": 1,
            "username": 1,
            "id": 18
        },
        {
            "birthday": 1,
            "certNum": 1,
            "realname": 1,
            "organizationName": 1,
            "roleName": 1,
            "sex": 1,
            "status": 1,
            "username": 1,
            "id": 19
        },
        {
            "birthday": 1,
            "certNum": 1,
            "realname": 1,
            "organizationName": 1,
            "roleName": 1,
            "sex": 1,
            "status": 1,
            "username": 1,
            "id": 20
        },
        {
            "birthday": 1,
            "certNum": 1,
            "realname": 1,
            "organizationName": 1,
            "roleName": 1,
            "sex": 1,
            "status": 1,
            "username": 1,
            "id": 21
        }
    ],
        "recordsFiltered": 333,
        "draw": 1,
        "recordsTotal": 999
    })
})

router.get('/nationAreaList',function (req, res, next) {
    res.json({
        "message": 1,
        "result": 'success',
        "resultData": [
            {
                "id": 1,
                "name": "中国"
            },
            {
                "id": 2,
                "name": 2
            },
            {
                "id": 3,
                "name": 3
            },
            {
                "id": 4,
                "name": 4
            },
            {
                "id": 5,
                "name": 5
            }
        ]
    })
})

router.get('/nationList',function(req,res,next){
    res.json({
        "message": 1,
        "result": 'success',
        "resultData": [
            {
                "id": 1,
                "name": 1
            },
            {
                "id": 2,
                "name": 2
            },
            {
                "id": 3,
                "name": 3
            },
            {
                "id": 4,
                "name": 4
            },
            {
                "id": 5,
                "name": 5
            },
            {
                "id": 6,
                "name": 6
            }
        ]
    })
})


module.exports = router;/**
 * Created by zhuo on 2017/8/1.
 */
